package com.ruoyi.chengkao.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.chengkao.domain.CkCandidateAudit;
import com.ruoyi.chengkao.service.ICkCandidateAuditService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 考生信息审核Controller
 * 
 * @author xiaosong
 * @date 2025-03-15
 */
@Api(tags = "成人高考-考生审核管理")
@RestController
@RequestMapping("/chengkao/CKaudit")
public class CkCandidateAuditController extends BaseController
{
    @Autowired
    private ICkCandidateAuditService ckCandidateAuditService;

    /**
     * 查询考生信息审核列表
     */
    @PreAuthorize("@ss.hasPermi('chengkao:CKaudit:list')")
    @GetMapping("/list")
        @ApiOperation("成人高考考生审核管理 - 分页查询列表")
    public TableDataInfo list(CkCandidateAudit ckCandidateAudit)
    {
        startPage();
        List<CkCandidateAudit> list = ckCandidateAuditService.selectCkCandidateAuditList(ckCandidateAudit);
        return getDataTable(list);
    }

    /**
     * 导出考生信息审核列表
     */
    @PreAuthorize("@ss.hasPermi('chengkao:CKaudit:export')")
    @Log(title = "考生信息审核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
        @ApiOperation("成人高考考生审核管理 - 导出数据")
    public void export(HttpServletResponse response, CkCandidateAudit ckCandidateAudit)
    {
        List<CkCandidateAudit> list = ckCandidateAuditService.selectCkCandidateAuditList(ckCandidateAudit);
        ExcelUtil<CkCandidateAudit> util = new ExcelUtil<CkCandidateAudit>(CkCandidateAudit.class);
        util.exportExcel(response, list, "考生信息审核数据");
    }

    /**
     * 获取考生信息审核详细信息
     */
    @PreAuthorize("@ss.hasPermi('chengkao:CKaudit:query')")
    @GetMapping(value = "/{id}")
        @ApiOperation("成人高考考生审核管理 - 根据ID获取详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(ckCandidateAuditService.selectCkCandidateAuditById(id));
    }

    /**
     * 新增考生信息审核
     */
    @PreAuthorize("@ss.hasPermi('chengkao:CKaudit:add')")
    @Log(title = "考生信息审核", businessType = BusinessType.INSERT)
    @PostMapping
        @ApiOperation("成人高考考生审核管理 - 新增数据")
    public AjaxResult add(@RequestBody CkCandidateAudit ckCandidateAudit)
    {
        return toAjax(ckCandidateAuditService.insertCkCandidateAudit(ckCandidateAudit));
    }

    /**
     * 修改考生信息审核
     */
    @PreAuthorize("@ss.hasPermi('chengkao:CKaudit:edit')")
    @Log(title = "考生信息审核", businessType = BusinessType.UPDATE)
    @PutMapping
        @ApiOperation("成人高考考生审核管理 - 修改数据")
    public AjaxResult edit(@RequestBody CkCandidateAudit ckCandidateAudit)
    {
        return toAjax(ckCandidateAuditService.updateCkCandidateAudit(ckCandidateAudit));
    }

    /**
     * 删除考生信息审核
     */
    @PreAuthorize("@ss.hasPermi('chengkao:CKaudit:remove')")
    @Log(title = "考生信息审核", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
        @ApiOperation("成人高考考生审核管理 - 删除数据")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ckCandidateAuditService.deleteCkCandidateAuditByIds(ids));
    }
}
